ECHO OFF
SET SOURCE_ROOT=C:\DanTFS\BizTalkESB\Solutions

ECHO Adding Assemblies to the GAC...
powershell.exe set-executionpolicy unrestricted
powershell.exe "& '%SOURCE_ROOT%\BizTalk.ESB.Extensions\GacEsbExtensionAssemblies.ps1'"
ECHO.
ECHO.

REM Visual Studio 2013 Extensions Path for Itineraries
SET VS_EXTENSIONS_LIB_PATH=C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Microsoft.Practices.Services.Itinerary.DslPackage\Lib
SET VS_EXTENSIONS_PATH=C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Microsoft.Practices.Services.Itinerary.DslPackage

ECHO Copying Itinerary Extenders to Visual Studio Extensions Directory
ECHO.
ECHO 	Copying the ItineraryExporters...
XCOPY "%SOURCE_ROOT%\BizTalk.ESB.Extensions\Projects\ItineraryExporters\bin\Debug\BizTalk.ESB.Extensions.ItineraryExporters.dll" "%VS_EXTENSIONS_LIB_PATH%" /Y
ECHO 	Copying the AdapterProviders...
XCOPY "%SOURCE_ROOT%\BizTalk.ESB.Extensions\Projects\AdapterProviders\bin\Debug\BizTalk.ESB.Extensions.AdapterProviders.dll" "%VS_EXTENSIONS_LIB_PATH%" /Y
ECHO 	Copying the ResolverExtenders...
XCOPY "%SOURCE_ROOT%\BizTalk.ESB.Extensions\Projects\ResolverExtenders\bin\Debug\BizTalk.ESB.Extensions.ResolverExtenders.dll" "%VS_EXTENSIONS_LIB_PATH%" /Y
ECHO 	Copying the ServiceExtenders...
XCOPY "%SOURCE_ROOT%\BizTalk.ESB.Extensions\Projects\ServiceExtenders\bin\Debug\BizTalk.ESB.Extensions.ServiceExtenders.dll" "%VS_EXTENSIONS_LIB_PATH%" /Y
ECHO.
ECHO.

ECHO Copying Manifest XML to Visual Studio Extensions Directory
ECHO.
ECHO	Copying the Bam Tracking Manifest XML...
XCOPY  "%SOURCE_ROOT%\BizTalk.ESB.Extensions\BamTrackingManifest.xml" "%VS_EXTENSIONS_PATH%" /Y
XCOPY  "%SOURCE_ROOT%\BizTalk.ESB.Extensions\BamTrackingManifest.xml" "%VS_EXTENSIONS_LIB_PATH%" /Y
ECHO	Copying the Itinerary Designer Extension Manifest XML...
XCOPY  "%SOURCE_ROOT%\BizTalk.ESB.Extensions\Itinerary Designer Extension Manifest Additions.xml" "%VS_EXTENSIONS_PATH%" /Y
XCOPY  "%SOURCE_ROOT%\BizTalk.ESB.Extensions\Itinerary Designer Extension Manifest Additions.xml" "%VS_EXTENSIONS_LIB_PATH%" /Y
ECHO	Copying the WSS Adapter Provider Property Manifest XML...
XCOPY  "%SOURCE_ROOT%\BizTalk.ESB.Extensions\WssPropertyManifest.xml" "%VS_EXTENSIONS_PATH%" /Y
XCOPY  "%SOURCE_ROOT%\BizTalk.ESB.Extensions\WssPropertyManifest.xml" "%VS_EXTENSIONS_LIB_PATH%" /Y
ECHO.
ECHO.

ECHO Archive Existing esb.config File
COPY "C:\Program Files (x86)\Microsoft BizTalk ESB Toolkit\esb.config" "C:\Program Files (x86)\Microsoft BizTalk ESB Toolkit\PREVIOUS-esb.config"
ECHO.
REM ECHO Replace esb.config File with fixed version for Unity Framework
REM XCOPY "%SOURCE_ROOT%\BizTalk.ESB.Extensions\modified_esb.config" "C:\Program Files (x86)\Microsoft BizTalk ESB Toolkit\esb.config" /y
REM ECHO.
ECHO Adding Extension nodes to esb.config...
powershell.exe set-executionpolicy unrestricted
powershell.exe "& '%SOURCE_ROOT%\BizTalk.ESB.Extensions\UpdateEsbXmlConfigurationFiles.ps1'"
ECHO.
ECHO Replace existing ESB Config with new esb.config
MOVE /Y "%SOURCE_ROOT%\BizTalk.ESB.Extensions\new-esb.config" "C:\Program Files (x86)\Microsoft BizTalk ESB Toolkit\esb.config"
ECHO.
ECHO.

pause 